// DrVarObject
package main

type IObject interface {
	AsString() string
	Print(interp *Interpreter)
	executeMethod(funcName string, prams []IObject) IObject
	getType() DataType
	getMembers() map[string]IObject
	getDouble() float64
	getInt() int
}
type IIterable interface {
	ResetCursor()
	Next() IObject
}
type ISequence interface {
	IIterable
	IObject
	Len() int
	getValueAt(int) IObject
}
type IObSequence interface {
	ISequence
	GetElems() []IObject
}

type DrVarObject struct {
	IObSequence
	DrAbstractObject
	cursor   int
	Elements []IObject
}

func (self *DrVarObject) Len() int {
	return len(self.Elements)

}
func (self *DrVarObject) ResetCursor() {
	self.cursor = 0
}
func (self *DrVarObject) Next() IObject {
	if self.cursor == len(self.GetElems()) {
		return nil
	}
	result := self.GetElems()[self.cursor]
	self.cursor += 1
	return result
}
func (self *DrVarObject) GetValue(index int) IObject {
	return self.GetElems()[index]
}
func (self *DrVarObject) GetElems() []IObject {
	return self.Elements
}
func (self *DrVarObject) Copy() *DrVarObject {
	list := new(DrVarObject)
	copy(list.Elements, self.GetElems())
	return list
}
func (self *DrVarObject) AsString() string {
	elems := self.GetElems()
	var s string
	for _, v := range elems {
		s = s + " " + v.AsString()
	}
	return s
}
